package com.nongda.controller;

import com.nongda.dto.ChuKuDto;
import com.nongda.dto.LiuShuiChaCunDto;
import com.nongda.dto.LiuShuiDto;
import com.nongda.result.LiuShuiResult;
import com.nongda.result.Result;
import com.nongda.service.TaiZhangService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/taizhang")
@Slf4j
public class TaiZhangController {
    @Autowired
    TaiZhangService taiZhangService;
    @PostMapping
    public Result chuku(@RequestBody ChuKuDto chuKuDto){
        int chuku = taiZhangService.chuku(chuKuDto);
        return  Result.success(chuku);
    }
    @PutMapping
    public Result ruku(@RequestBody ChuKuDto chuKuDto){
        int ruku=taiZhangService.ruku(chuKuDto);
        return Result.success(ruku);
    }
    @GetMapping
    public Result<LiuShuiResult> pageLiuShui(@RequestBody LiuShuiChaCunDto liuShuiDto){
        LiuShuiResult result=taiZhangService.pageLiuShui(liuShuiDto);
        return Result.success(result);
    }
}
